#ifndef DATA_HOLDER_H_
#define DATA_HOLDER_H_

#include <string.h>
#include <stdint.h>
#include <iostream>
#include <vector>
#pragma pack(1)



struct Robot_Power_Board
{
	uint32_t status;
    uint8_t btn;
};

struct Robot_Battery_Data
{
    uint16_t circletime;
    uint16_t curpower;
    uint16_t totalpower;
    uint8_t perpower;
    uint8_t chargestatus;
};

struct BatStatusInfo
{
    uint16_t cellhighestvol;
    uint16_t celllowestvol;
    uint8_t cellnumofhighestvol;
    uint8_t cellnumoflowestvol;
    uint8_t highesttemp;
    uint8_t lowesttemp;
    uint8_t cellnumofhighesttemp;
    uint8_t cellnumoflowesttemp;
    uint16_t equilibriumstatus;
    uint16_t totalvol;
    uint16_t totalcur;
    uint16_t bmsstatus;
    uint8_t switchstatus;
    uint8_t errcode;
    uint16_t soc;
    uint16_t soh;
};

struct FlagType
{
  bool _ledbarorderupdate;
  bool _chargeorderupdate;
  bool _liftorderupdate;
  bool _shutdownflag;
  bool _pstwodataupdate;
  bool _batteryupdate;
  bool _bleconnectflag;
  bool _chargestatusupdate;
  bool _btndataupdate;

};

#pragma pack(0)

class Data_holder{
    public:
        static Data_holder* get(){
            static Data_holder dh;
            return &dh;
        }

        void load_parameter();

        void save_parameter();

    private:
        Data_holder()
		{	
			memset(&power_board, 0, sizeof(struct Robot_Power_Board));
 
            memset(&batterydata, 0, sizeof(struct Robot_Battery_Data));

            memset(&Flag,0,sizeof(FlagType));

            memset(&batteryinfo,0,sizeof(BatStatusInfo));
        }
    public:
		struct Robot_Power_Board power_board;

        struct Robot_Battery_Data batterydata;
   
        struct FlagType Flag;

        struct BatStatusInfo batteryinfo;
};
#endif

